<template>
  <el-dialog
   v-model="dialogVisible"
   title="工作经历"
   :before-close="CloseDia"
   width="70%">
    <div class="data-container">
        <el-table :data="tableData" style="width: 100%">
        <el-table-column type="index" width="80" label="序号"/>
        <el-table-column prop="startDate" label="开始时间" width="240">
          <template  #default="scope">
            <template v-if="scope.row.edit">
              <el-date-picker
                type="date"
                placeholder="选择年月日"
                value-format="YYYY-MM-DD"
                v-model="scope.row.startDate">
              </el-date-picker>
            </template>
            {{ scope.row.startDate }}
            <!-- <el-input></el-input> -->
          </template>
        </el-table-column>
        <el-table-column prop="endDate" label="结束时间" width="240">
          <template #default="scope">
            {{ scope.row.endDate }}
          </template>
        </el-table-column>
        <el-table-column prop="company" label="工作单位" width="200">
          <template #default="scope">
            {{ scope.row.company }}
          </template>
        </el-table-column>
        <el-table-column prop="department" label="所在部门" width="200">
          <template #default="scope">
            {{ scope.row.department }}
          </template>
        </el-table-column>
        <el-table-column prop="duties" label="职业/职务" width="200">
          <template #default="scope">
            {{ scope.row.duties }}
          </template>
        </el-table-column>
        <el-table-column prop="hospitalLevel" label="医院等级" width="180">
          <template #default="scope">
            {{ scope.row.hospitalLevel }}
          </template>
        </el-table-column>
      </el-table>
    </div>
   </el-dialog>
</template>

<script setup>
import { ref, watch, onActivated, defineEmits, defineProps, computed } from 'vue'
import { getObjectById } from '@/api/recruit'
const dialogVisible = computed(() => props.isShow)

const id = computed(() => props.currentId)
const props = defineProps({
  isShow: {
    type: Boolean,
    default: false
  },
  currentId: {
    type: Number
  }
})
const emits = defineEmits(['onCancel', 'click'])

const CloseDia = () => {
  emits('diaCancel', false)
}

const tableData = ref([])

const selectFormStore = id => {
  getObjectById('work', id).then(res => {
    console.log(res)
    tableData.value = res
  })
}

watch(() => {
  if (id.value) {
    selectFormStore(id.value)
  } else {
    tableData.value = []
  }
})
</script>

<style>

</style>
